// ---------------------------------------------------------------------
//
// -- 基类包
// -- author £
//
// ---------------------------------------------------------------------

let mybase = {
    //中介层基类
    BaseMediator: cc.Class({
        name: "BaseMediator",
        properties: {
            //场景
            scene: null,    
            //模型 
            model: null,
        },

        ctor: function () {
            this.initCtor();
            this.clearData();
        },

        initCtor: function () {
            
        },

        clearData: function () {
        },

        register: function (v) {
            this.scene = v;
            this.onRegister(v);
        },

        /** 注册后 */
        onRegister: function (v) {

        },

        release: function () {
            this.onRelease();
            this.clearData();
        },

        onShow: function () {

        },

        onHide: function () {
            this.clearData();
            this.model.clearData();

            if (this.scene && this.scene.onHide)
                this.scene.onHide();
        },

        onRelease: function () {
            this.scene = null;
            this.model.clearData();
            // require('Alert').unbindUI();
        },

    }),

    //模型层基类
    BaseModel: cc.Class({
        name: "BaseModel",
        properties: {
            ip: '',
            port: 0,
        },

        ctor: function () {
            this.initCtor();
            this.clearData();
        },

        initCtor: function () {
        },

        clearData: function () {
        },

        resetData: function () {

        },

    }),
};

module.exports = mybase;